package com.allwees.core.common.constant;

import com.allwees.core.common.i18n.MessageSourceUtil;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.allwees.core.common.util.http.RequestContext;

import java.util.ResourceBundle;

/**
 * Entity状态
 *
 * @author yangylsky
 * @since 2019-12-09
 */
public enum EStatus implements IEnum<Integer> {
    /**
     * 正常
     */
    NORMAL(0, "Normal"),

    /**
     * 已使用
     */
    USED(1, "Used"),

    /**
     * 缺货
     */
    SELLOUT(2, "Out of stock"),


    CREATED(3, "新创建"),

    WAIT_AUDIT(4, "待审核"),

    AUDIT_APPROVED(5, "审核通过"),

    AUDIT_REJECTED(6, "审核拒绝"),

    WAIT_PUTON(7, "待上架"),

    WITH_DRAW_FAILED(8, "提现失败"),

    PUTOFF_ONESELF(10, "主动下架"),

    PUTOFF_QA_FAILURE(11, "质检不合格下架"),

    PUTOFF_OTHERS(12, "其它原因下架"),

    PUTOFF_SELLOUT(13, "缺货下架"),

    PUTOFF_EDITING(14, "下架编辑中"),

    COMPLETED(18, "已完成"),

    DISABLED(19, "已禁用"),

    DISABLED_FORBID_SALE(20, "已禁售"),

    /*======================== Order begin ======================*/
    SHIPPED(23, "已发货"),

    REFUND(26, "退货"),

    COUPON_EXPIRED(24, "已过期"),
    /*======================== Order end ======================*/

    /*======================== OMS begin ======================*/
    OMS_CANCELED(29, "已取消"),

    OMS_WAIT_MERCHANT_SHIP(30, "待发货"),

//	OMS_MERCHANT_SHIPPED(32, "已发货"),

    OMS_FROM_WMS_REFUND(34, "退货"),

    OMS_ENTERED_WAREHOUSE(36, "已入仓"),

    OMS_SHIPPED(38, "已发货"),

    OMS_WAIT_RECEIVE(40, "待收货"),

    OMS_DELIVERED(41, "已妥投"),

    OMS_RECEIVED(42, "已收货"),

    OMS_REFUNDING(44, "退货中"),

    OMS_REFUND(46, "已退货"),

    OMS_TO_SETTLE(48, "待结算"),

    OMS_SETTLED(50, "已结算"),

    OMS_REFUND_REJECT(52, "退货驳回"),
    /*======================== OMS end ======================*/

    /*======================== SCM begin ======================*/
    SCM_WAIT_ENTER(80, "待入仓"),

    SCM_ENTERING(82, "部分入仓"),

    SCM_ENTERED(84, "已入仓"),

    SCM_JOINED_PICK(86, "已加入拣货单"),

    SCM_REFUND_ORDER(88, "退单"),

    SCM_TIMEOUT(90, "超时异常"),

    SCM_TIMEOUT_REFUND(92, "超时退货"),

    /*======================== SCM end ======================*/



    /*======================== MMS end ======================*/
    MMS_FIRST_AUDIT_APPROVED(101, "初审通过"),

    MMS_FIRST_AUDIT_REJECTED(102, "初审拒绝"),

    MMS_FINAL_AUDIT_REJECTED(103, "终审拒绝"),

    MMS_PERFECT_INFO(105, "完善信息中"),

    /*======================== MMS end ======================*/

    /*======================== WMS begin ======================*/
    WMS_WAIT_ALLOCATE(121, "待分配"),

    WMS_ALLOCATED(122, "已分配"),

    WMS_WAIT_PICK(123, "待拣货"),

    WMS_PICKING(124, "拣货中"),

    WMS_PICKED(125, "拣货完成"),

    WMS_SHIPPED(126, "已发货"),
    /*======================== WMS end ======================*/;

    private final int value;

    private String desc;

    EStatus(int value) {
        this.value = value;
    }

    EStatus(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public Integer value() {
        return value;
    }

    public String desc() {
        return MessageSourceUtil.getMessage(this);
    }

    @Override
    public Integer getValue() {
        return value;
    }

    public static EStatus byValue(Integer status) {
        for (EStatus e : values()) {
            if (e.value == status) {
                return e;
            }
        }
        throw new IllegalArgumentException("No EStatus enum found by value[" + status + "]");
    }
}
